package com.qingfeng.basic_lib.net.interceptor

import android.content.Context
import android.util.AttributeSet
import android.view.ViewGroup
import androidx.annotation.AttrRes
import okhttp3.Interceptor
import okhttp3.Response

class BaseInterceptor(private val headers: Map<String, String>?) : Interceptor{

    override fun intercept(chain: Interceptor.Chain): Response {
        return chain.proceed(chain.request().newBuilder().run {
            if (!headers.isNullOrEmpty()) {
                for (headMap in headers) {
                    addHeader(headMap.key, headMap.value).build()
                }
            }
            build()
        })
    }


}

